<?php
class RecaudacionesController extends AppController {

	var $name = 'Recaudaciones';
    
	function index() {
		$this->Recaudacione->recursive = 0;
		$this->set('recaudaciones', $this->paginate());
	}

	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid recaudacione', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->set('recaudacione', $this->Recaudacione->read(null, $id));
	}

	function add() {
		if (!empty($this->data)) {
			$this->Recaudacione->create();
			if ($this->Recaudacione->save($this->data)) {
				$this->Session->setFlash(__('The recaudacione has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The recaudacione could not be saved. Please, try again.', true));
			}
		}
	}

	function edit($id = null) {
		if (!$id && empty($this->data)) {
			$this->Session->setFlash(__('Invalid recaudacione', true));
			$this->redirect(array('action' => 'index'));
		}
		if (!empty($this->data)) {
			if ($this->Recaudacione->save($this->data)) {
				$this->Session->setFlash(__('The recaudacione has been saved', true));
				$this->redirect(array('action' => 'index'));
			} else {
				$this->Session->setFlash(__('The recaudacione could not be saved. Please, try again.', true));
			}
		}
		if (empty($this->data)) {
			$this->data = $this->Recaudacione->read(null, $id);
		}
	}

	function delete($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid id for recaudacione', true));
			$this->redirect(array('action'=>'index'));
		}
		if ($this->Recaudacione->delete($id)) {
			$this->Session->setFlash(__('Recaudacione deleted', true));
			$this->redirect(array('action'=>'index'));
		}
		$this->Session->setFlash(__('Recaudacione was not deleted', true));
		$this->redirect(array('action' => 'index'));
	}
    function beforeFilter() {
		//$this->Acl->allow($aroAlias, $acoAlias);
   		 parent::beforeFilter();
    		    	
			$this->Auth->allow(array('*'));
	}
}
?>